import java.util.*;
public class nl1603 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int k=sc.nextInt();
        
        int a[]=new int[n+1];
        for(int i=0;i<n;i++){
            a[i]=i;
        } 
        int x,y;
        for(int i=0;i<k;i++){
            x=sc.nextInt();
            y=sc.nextInt();
            if(x==1){
                a[y]=-1;
            }
            if(x==2){
                for(int j=y-1;j>=0;j--){
                    if(j<0){
                        System.out.println(0);
                        break;
                    }
                    if(a[j]!=-1){
                        System.out.println(a[j]);
                        break;
                    }
                    if(j==0){
                        System.out.println(0);
                        break;
                    }
                }
            }
        }
    }
}
